#include <iostream>
#include "table.h"

Table::Table(){
	StartRec = new Record;
	StartRec->next = NULL;
}

Table::~Table(){
	Record *r = StartRec;
	Record *tmp;
	while(r != NULL){
		tmp = r->next;
		delete r;
		r = tmp;
	}
}

void Table::print()const{
  //I'm going to put in column printing here so it will give a nice view
  for(int x=0;x<int(AttributeName.size());++x){
    cout << AttributeName[x] << " ";
  }
  cout << endl;
  Record*ptr=StartRec->next;
  while(ptr!=NULL){
    for(int x=0;x<int(ptr->RecordPtr.size());++x){
      switch(AttributeType[x]){
        case FloatType:
          cout << (*((float*)(AttributeType[x])));
          break;
        case IntType:
          cout << (*((int*)(AttributeType[x])));
          break;
        case StringType:
          cout << (*((string*)(AttributeType[x])));
          break;
      }
      cout << " ";
    }
    cout << endl;
    ptr=ptr->next;
  }
}
/*
View::View(){}
View::~View(){}
*/